//
//  RYTitleCell.swift
//  App_Profile
//
//  Created by 蒋晨成 on 2022/2/8.
//

import Adaptor
import Foundation
import UIKit

public class RYTitleCell: RYBaseCell {
    lazy var titleLabel: UILabel = .init()
        .x
        .textColor(Adaptor.Profile.Setting.titleTextColor)
        .font(.root)
        .instance

    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }

    @available(*, unavailable)
    required init?(coder _: NSCoder) { fatalError("init(coder:) has not been implemented") }

    override func reusableCell(_ cellModel: RYBaseCellModel) {
        super.reusableCell(cellModel)
        guard let cellModel = cellModel as? RYTitleCellModel else { return }
        titleLabel.text = cellModel.title
    }
}

private extension RYTitleCell {
    func setupUI() {
        titleLabel.x.add(to: contentView).snp.makeConstraints {
            $0.leading.equalToSuperview().offset(20)
            $0.centerY.equalToSuperview()
        }
    }
}
